var industry_list = [
    {
    "parent_int":"女装",
    "name":"连衣裙"
    },
    {
    "name":"女装"
    },
    {
    "parent_int":"女装",
    "name":"半身裙"
    },
    {
    "parent_int":"女装",
    "name":"A字群"
    },
    {
    "name":"数码"
    },
    {
    "parent_int":"数码",
    "name":"电脑配件"
    },
    {
    "parent_int":"电脑配件",
    "name":"内存"
    } 
]
let newObj = {},key = '',keyName=[]
function convert_format(data){
    for(let i in data){
        let obj = data[i]
        if (!obj.hasOwnProperty("parent_int")){
            key = obj.name
            keyName.push(key)
            newObj[key] = {}
            // data.splice(i,1)  
            // data.forEach((item,i) => {
            //     if(item.parent_int===key){
            //         newObj[key][item.name] = {}
            //     }
            // }); 
        }
        console.log(newObj);
        newObj = deepCopy(newObj)
        function deepCopy(objs){
            for (let key1 in keyName) {
                if (obj.hasOwnProperty("parent_int")){
                    key = obj.name
                    key1===obj.parent_int?deepCopy(newObj[key1][key]):newObj[key1][key]={}
                }
            }
            return newObj
        }
        console.log(newObj);
        
    }
    // Object.keys(newObj).forEach(key1=>{
    //     for (const key2 in newObj[key1]) {
    //         data.forEach((item,i) => {
    //             if(item.parent_int===key2){
    //                 newObj[key1][key2][item.name] = {}
    //             }
    //         }); 
    //     }
    // })
    // console.log(newObj);

    /*
    {女装: {…}, 数码: {…}}
女装:
A字群: {}
半身裙: {}
连衣裙: {}
__proto__: Object
数码:
电脑配件:
内存: {}

    */
}

setTimeout(() => {
    convert_format(industry_list)
}, 1000);